<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>module Gem - rubygems: Ruby Standard Library Documentation</title>


<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>

<script src="./js/jquery-3.2.0.min.js"></script>

<script src="./js/vue.min.js"></script>
<script src="./js/js.cookie.min.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="./css/rdoc.css" rel="stylesheet">
<link href="./css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
  var index_rel_prefix = "./";
  var darkModeCsseHref = "./css/rdoc-dm.css"
  var defaultModeCssHref = "./css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="module">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="./index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    
<div class="nav-section">
  <h3>Table of Contents</h3>

  <ul class="link-list" role="directory">
    <li><a href="#module-Gem-label-RubyGems+Plugins">RubyGems Plugins</a>
    <li><a href="#module-Gem-label-RubyGems+Defaults-2C+Packaging">RubyGems Defaults, Packaging</a>
    <li><a href="#module-Gem-label-Bugs">Bugs</a>
    <li><a href="#module-Gem-label-Credits">Credits</a>
    <li><a href="#module-Gem-label-License">License</a>
  </ul>
</div>


    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-activated_gem_paths">::activated_gem_paths</a>
    <li ><a href="#method-c-add_to_load_path">::add_to_load_path</a>
    <li ><a href="#method-c-already_loaded-3F">::already_loaded?</a>
    <li ><a href="#method-c-bin_path">::bin_path</a>
    <li ><a href="#method-c-binary_mode">::binary_mode</a>
    <li ><a href="#method-c-bindir">::bindir</a>
    <li ><a href="#method-c-cache_home">::cache_home</a>
    <li ><a href="#method-c-clear_default_specs">::clear_default_specs</a>
    <li ><a href="#method-c-clear_paths">::clear_paths</a>
    <li ><a href="#method-c-config_file">::config_file</a>
    <li ><a href="#method-c-config_home">::config_home</a>
    <li ><a href="#method-c-configuration">::configuration</a>
    <li ><a href="#method-c-configuration-3D">::configuration=</a>
    <li ><a href="#method-c-data_home">::data_home</a>
    <li ><a href="#method-c-default_bindir">::default_bindir</a>
    <li ><a href="#method-c-default_cert_path">::default_cert_path</a>
    <li ><a href="#method-c-default_dir">::default_dir</a>
    <li ><a href="#method-c-default_exec_format">::default_exec_format</a>
    <li ><a href="#method-c-default_ext_dir_for">::default_ext_dir_for</a>
    <li ><a href="#method-c-default_gem_load_paths">::default_gem_load_paths</a>
    <li ><a href="#method-c-default_key_path">::default_key_path</a>
    <li ><a href="#method-c-default_path">::default_path</a>
    <li ><a href="#method-c-default_rubygems_dirs">::default_rubygems_dirs</a>
    <li ><a href="#method-c-default_sources">::default_sources</a>
    <li ><a href="#method-c-default_spec_cache_dir">::default_spec_cache_dir</a>
    <li ><a href="#method-c-default_specifications_dir">::default_specifications_dir</a>
    <li ><a href="#method-c-deflate">::deflate</a>
    <li ><a href="#method-c-dir">::dir</a>
    <li ><a href="#method-c-done_installing">::done_installing</a>
    <li ><a href="#method-c-ensure_default_gem_subdirectories">::ensure_default_gem_subdirectories</a>
    <li ><a href="#method-c-ensure_gem_subdirectories">::ensure_gem_subdirectories</a>
    <li ><a href="#method-c-env_requirement">::env_requirement</a>
    <li ><a href="#method-c-find_config_file">::find_config_file</a>
    <li ><a href="#method-c-find_files">::find_files</a>
    <li ><a href="#method-c-find_home">::find_home</a>
    <li ><a href="#method-c-find_latest_files">::find_latest_files</a>
    <li ><a href="#method-c-find_spec_for_exe">::find_spec_for_exe</a>
    <li ><a href="#method-c-find_unresolved_default_spec">::find_unresolved_default_spec</a>
    <li ><a href="#method-c-finish_resolve">::finish_resolve</a>
    <li ><a href="#method-c-host">::host</a>
    <li ><a href="#method-c-host-3D">::host=</a>
    <li ><a href="#method-c-install">::install</a>
    <li ><a href="#method-c-java_platform-3F">::java_platform?</a>
    <li ><a href="#method-c-latest_rubygems_version">::latest_rubygems_version</a>
    <li ><a href="#method-c-latest_spec_for">::latest_spec_for</a>
    <li ><a href="#method-c-latest_version_for">::latest_version_for</a>
    <li ><a href="#method-c-load_env_plugins">::load_env_plugins</a>
    <li ><a href="#method-c-load_path_insert_index">::load_path_insert_index</a>
    <li ><a href="#method-c-load_plugins">::load_plugins</a>
    <li ><a href="#method-c-load_yaml">::load_yaml</a>
    <li ><a href="#method-c-location_of_caller">::location_of_caller</a>
    <li ><a href="#method-c-marshal_version">::marshal_version</a>
    <li ><a href="#method-c-needs">::needs</a>
    <li ><a href="#method-c-open_file">::open_file</a>
    <li ><a href="#method-c-operating_system_defaults">::operating_system_defaults</a>
    <li ><a href="#method-c-path">::path</a>
    <li ><a href="#method-c-path_separator">::path_separator</a>
    <li ><a href="#method-c-paths">::paths</a>
    <li ><a href="#method-c-paths-3D">::paths=</a>
    <li ><a href="#method-c-platform_defaults">::platform_defaults</a>
    <li ><a href="#method-c-platforms">::platforms</a>
    <li ><a href="#method-c-platforms-3D">::platforms=</a>
    <li ><a href="#method-c-plugin_suffix_pattern">::plugin_suffix_pattern</a>
    <li ><a href="#method-c-plugin_suffix_regexp">::plugin_suffix_regexp</a>
    <li ><a href="#method-c-plugindir">::plugindir</a>
    <li ><a href="#method-c-post_build">::post_build</a>
    <li ><a href="#method-c-post_install">::post_install</a>
    <li ><a href="#method-c-post_reset">::post_reset</a>
    <li ><a href="#method-c-post_uninstall">::post_uninstall</a>
    <li ><a href="#method-c-pre_install">::pre_install</a>
    <li ><a href="#method-c-pre_reset">::pre_reset</a>
    <li ><a href="#method-c-pre_uninstall">::pre_uninstall</a>
    <li ><a href="#method-c-prefix">::prefix</a>
    <li ><a href="#method-c-read_binary">::read_binary</a>
    <li ><a href="#method-c-refresh">::refresh</a>
    <li ><a href="#method-c-register_default_spec">::register_default_spec</a>
    <li ><a href="#method-c-ruby">::ruby</a>
    <li ><a href="#method-c-ruby_api_version">::ruby_api_version</a>
    <li ><a href="#method-c-ruby_engine">::ruby_engine</a>
    <li ><a href="#method-c-ruby_version">::ruby_version</a>
    <li ><a href="#method-c-rubygems_version">::rubygems_version</a>
    <li ><a href="#method-c-solaris_platform-3F">::solaris_platform?</a>
    <li ><a href="#method-c-source_date_epoch">::source_date_epoch</a>
    <li ><a href="#method-c-source_date_epoch_string">::source_date_epoch_string</a>
    <li ><a href="#method-c-sources">::sources</a>
    <li ><a href="#method-c-sources-3D">::sources=</a>
    <li ><a href="#method-c-spec_cache_dir">::spec_cache_dir</a>
    <li ><a href="#method-c-state_file">::state_file</a>
    <li ><a href="#method-c-state_home">::state_home</a>
    <li ><a href="#method-c-suffix_pattern">::suffix_pattern</a>
    <li ><a href="#method-c-suffix_regexp">::suffix_regexp</a>
    <li ><a href="#method-c-suffixes">::suffixes</a>
    <li ><a href="#method-c-time">::time</a>
    <li ><a href="#method-c-try_activate">::try_activate</a>
    <li ><a href="#method-c-ui">::ui</a>
    <li ><a href="#method-c-use_gemdeps">::use_gemdeps</a>
    <li ><a href="#method-c-use_paths">::use_paths</a>
    <li ><a href="#method-c-user_dir">::user_dir</a>
    <li ><a href="#method-c-user_home">::user_home</a>
    <li ><a href="#method-c-win_platform-3F">::win_platform?</a>
    <li ><a href="#method-c-write_binary">::write_binary</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="module-Gem">
    <h1 id="module-Gem" class="module">
      module Gem
    </h1>

    <section class="description">
    
<p>RubyGems is the Ruby standard for publishing and managing third party libraries.</p>

<p>For user documentation, see:</p>
<ul><li>
<p><code>gem help</code> and <code>gem help [command]</code></p>
</li><li>
<p><a href="https://guides.rubygems.org/">RubyGems User Guide</a></p>
</li><li>
<p><a href="https://guides.rubygems.org/faqs">Frequently Asked Questions</a></p>
</li></ul>

<p>For gem developer documentation see:</p>
<ul><li>
<p><a href="https://guides.rubygems.org/make-your-own-gem">Creating Gems</a></p>
</li><li>
<p><a href="Gem/Specification.html"><code>Gem::Specification</code></a></p>
</li><li>
<p><a href="Gem/Version.html"><code>Gem::Version</code></a> for version dependency notes</p>
</li></ul>

<p>Further RubyGems documentation can be found at:</p>
<ul><li>
<p><a href="https://guides.rubygems.org">RubyGems Guides</a></p>
</li><li>
<p><a href="https://www.rubydoc.info/github/rubygems/rubygems">RubyGems API</a> (also available from <code>gem server</code>)</p>
</li></ul>

<h2 id="module-Gem-label-RubyGems+Plugins">RubyGems Plugins<span><a href="#module-Gem-label-RubyGems+Plugins">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>RubyGems will load plugins in the latest version of each installed gem or $LOAD_PATH.  Plugins must be named ‘rubygems_plugin’ (.rb, .so, etc) and placed at the root of your gem’s require_path.  Plugins are installed at a special location and loaded on boot.</p>

<p>For an example plugin, see the <a href="https://github.com/seattlerb/graph">Graph gem</a> which adds a <code>gem graph</code> command.</p>

<h2 id="module-Gem-label-RubyGems+Defaults-2C+Packaging">RubyGems Defaults, Packaging<span><a href="#module-Gem-label-RubyGems+Defaults-2C+Packaging">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>RubyGems defaults are stored in lib/rubygems/defaults.rb.  If you’re packaging RubyGems or implementing Ruby you can change RubyGems’ defaults.</p>

<p>For RubyGems packagers, provide lib/rubygems/defaults/operating_system.rb and override any defaults from lib/rubygems/defaults.rb.</p>

<p>For Ruby implementers, provide lib/rubygems/defaults/#{RUBY_ENGINE}.rb and override any defaults from lib/rubygems/defaults.rb.</p>

<p>If you need RubyGems to perform extra work on install or uninstall, your defaults override file can set pre/post install and uninstall hooks. See <a href="Gem.html#method-c-pre_install"><code>Gem::pre_install</code></a>, <a href="Gem.html#method-c-pre_uninstall"><code>Gem::pre_uninstall</code></a>, <a href="Gem.html#method-c-post_install"><code>Gem::post_install</code></a>, <a href="Gem.html#method-c-post_uninstall"><code>Gem::post_uninstall</code></a>.</p>

<h2 id="module-Gem-label-Bugs">Bugs<span><a href="#module-Gem-label-Bugs">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>You can submit bugs to the <a href="https://github.com/rubygems/rubygems/issues">RubyGems bug tracker</a> on GitHub</p>

<h2 id="module-Gem-label-Credits">Credits<span><a href="#module-Gem-label-Credits">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>RubyGems is currently maintained by Eric Hodel.</p>

<p>RubyGems was originally developed at RubyConf 2003 by:</p>
<ul><li>
<p>Rich Kilmer  – rich(at)infoether.com</p>
</li><li>
<p>Chad Fowler  – chad(at)chadfowler.com</p>
</li><li>
<p>David Black  – dblack(at)wobblini.net</p>
</li><li>
<p>Paul Brannan – paul(at)atdesk.com</p>
</li><li>
<p>Jim Weirich   – jim(at)weirichhouse.org</p>
</li></ul>

<p>Contributors:</p>
<ul><li>
<p>Gavin Sinclair     – gsinclair(at)soyabean.com.au</p>
</li><li>
<p>George Marrows     – george.marrows(at)ntlworld.com</p>
</li><li>
<p>Dick Davies        – rasputnik(at)hellooperator.net</p>
</li><li>
<p>Mauricio Fernandez – batsman.geo(at)yahoo.com</p>
</li><li>
<p>Simon Strandgaard  – neoneye(at)adslhome.dk</p>
</li><li>
<p>Dave Glasser       – glasser(at)mit.edu</p>
</li><li>
<p>Paul Duncan        – pabs(at)pablotron.org</p>
</li><li>
<p>Ville Aine         – vaine(at)cs.helsinki.fi</p>
</li><li>
<p>Eric Hodel         – drbrain(at)segment7.net</p>
</li><li>
<p>Daniel Berger      – djberg96(at)gmail.com</p>
</li><li>
<p>Phil Hagelberg     – technomancy(at)gmail.com</p>
</li><li>
<p>Ryan Davis         – ryand-ruby(at)zenspider.com</p>
</li><li>
<p>Evan Phoenix       – evan(at)fallingsnow.net</p>
</li><li>
<p>Steve Klabnik      – steve(at)steveklabnik.com</p>
</li></ul>

<p>(If your name is missing, PLEASE let us know!)</p>

<h2 id="module-Gem-label-License">License<span><a href="#module-Gem-label-License">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>See LICENSE.txt for permissions.</p>

<p>Thanks!</p>

<p>-The RubyGems Team</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="DEFAULT_HOST">DEFAULT_HOST
          <dd>
          <dt id="GEM_DEP_FILES">GEM_DEP_FILES
          <dd>
          <dt id="LOADED_SPECS_MUTEX">LOADED_SPECS_MUTEX
          <dd>
          <dt id="MARSHAL_SPEC_DIR">MARSHAL_SPEC_DIR
          <dd><p>Location of Marshal quick gemspecs on remote repositories</p>
          <dt id="RDoc">RDoc
          <dd>
          <dt id="REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES">REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES
          <dd><p>Subdirectories in a gem repository for default gems</p>
          <dt id="REPOSITORY_SUBDIRECTORIES">REPOSITORY_SUBDIRECTORIES
          <dd><p>Subdirectories in a gem repository</p>
          <dt id="RUBYGEMS_DIR">RUBYGEMS_DIR
          <dd>
          <dt id="UNTAINT">UNTAINT
          <dd><p>Taint support is deprecated in Ruby 2.7. This allows switching “.untaint” to “.tap(&amp;Gem::UNTAINT)”, to avoid deprecation warnings in Ruby 2.7.</p>
          <dt id="VERSION">VERSION
          <dd>
          <dt id="WIN_PATTERNS">WIN_PATTERNS
          <dd><p>An Array of Regexps that match windows Ruby platforms.</p>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-c-disable_system_update_message" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">disable_system_update_message</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>RubyGems distributors (like operating system package managers) can disable RubyGems update by setting this to error message printed to end-users on gem update –system instead of actual update.</p>
              </div>
            </div>
          <div id="attribute-c-discover_gems_on_require" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">discover_gems_on_require</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Whether RubyGems should enhance builtin ‘require` to automatically check whether the path required is present in installed gems, and automatically activate them and add them to `$LOAD_PATH`.</p>
              </div>
            </div>
          <div id="attribute-c-done_installing_hooks" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">done_installing_hooks</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The list of hooks to be run after <a href="Gem/DependencyInstaller.html"><code>Gem::DependencyInstaller</code></a> installs a set of gems</p>
              </div>
            </div>
          <div id="attribute-c-gemdeps" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">gemdeps</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>GemDependencyAPI object, which is set when .use_gemdeps is called. This contains all the information from the Gemfile.</p>
              </div>
            </div>
          <div id="attribute-c-loaded_specs" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">loaded_specs</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Hash of loaded <a href="Gem/Specification.html"><code>Gem::Specification</code></a> keyed by name</p>
              </div>
            </div>
          <div id="attribute-c-post_build_hooks" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">post_build_hooks</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The list of hooks to be run after <a href="Gem/Installer.html#method-i-install"><code>Gem::Installer#install</code></a> extracts files and builds extensions</p>
              </div>
            </div>
          <div id="attribute-c-post_install_hooks" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">post_install_hooks</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The list of hooks to be run after <a href="Gem/Installer.html#method-i-install"><code>Gem::Installer#install</code></a> completes installation</p>
              </div>
            </div>
          <div id="attribute-c-post_reset_hooks" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">post_reset_hooks</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The list of hooks to be run after <a href="Gem/Specification.html#method-c-reset"><code>Gem::Specification.reset</code></a> is run.</p>
              </div>
            </div>
          <div id="attribute-c-post_uninstall_hooks" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">post_uninstall_hooks</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The list of hooks to be run after <a href="Gem/Uninstaller.html#method-i-uninstall"><code>Gem::Uninstaller#uninstall</code></a> completes installation</p>
              </div>
            </div>
          <div id="attribute-c-pre_install_hooks" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">pre_install_hooks</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The list of hooks to be run before <a href="Gem/Installer.html#method-i-install"><code>Gem::Installer#install</code></a> does any work</p>
              </div>
            </div>
          <div id="attribute-c-pre_reset_hooks" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">pre_reset_hooks</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The list of hooks to be run before <a href="Gem/Specification.html#method-c-reset"><code>Gem::Specification.reset</code></a> is run.</p>
              </div>
            </div>
          <div id="attribute-c-pre_uninstall_hooks" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">pre_uninstall_hooks</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The list of hooks to be run before <a href="Gem/Uninstaller.html#method-i-uninstall"><code>Gem::Uninstaller#uninstall</code></a> does any work</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-activated_gem_paths" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">activated_gem_paths</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The number of paths in the +$LOAD_PATH+ from activated gems. Used to prioritize <code>-I</code> and +<a href="'RUBYLIB'">ENV</a>+ entries during <code>require</code>.</p>

                              <div class="method-source-code" id="activated_gem_paths-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 577</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">activated_gem_paths</span>
  <span class="ruby-ivar">@activated_gem_paths</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-add_to_load_path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_to_load_path</span><span
                                class="method-args">(*paths)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Add a list of paths to the $LOAD_PATH at the proper place.</p>

                              <div class="method-source-code" id="add_to_load_path-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 584</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">add_to_load_path</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">paths</span>)
  <span class="ruby-ivar">@activated_gem_paths</span> = <span class="ruby-identifier">activated_gem_paths</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">size</span>

  <span class="ruby-comment"># gem directories must come after -I and ENV[&#39;RUBYLIB&#39;]</span>
  <span class="ruby-identifier">$LOAD_PATH</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">load_path_insert_index</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">paths</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-bin_path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">bin_path</span><span
                                class="method-args">(name, exec_name = nil, *requirements)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Find the full path to the executable for gem <code>name</code>.  If the <code>exec_name</code> is not given, an exception will be raised, otherwise the specified executable’s path is returned.  <code>requirements</code> allows you to specify specific gem versions.</p>

                              <div class="method-source-code" id="bin_path-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 240</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">bin_path</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">exec_name</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">requirements</span>)
  <span class="ruby-identifier">requirements</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Requirement</span>.<span class="ruby-identifier">default</span> <span class="ruby-keyword">if</span>
    <span class="ruby-identifier">requirements</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">find_spec_for_exe</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">exec_name</span>, <span class="ruby-identifier">requirements</span>).<span class="ruby-identifier">bin_file</span> <span class="ruby-identifier">exec_name</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-binary_mode" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">binary_mode</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The mode needed to read a file as straight binary.</p>

                              <div class="method-source-code" id="binary_mode-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 294</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">binary_mode</span>
  <span class="ruby-string">&quot;rb&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-bindir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">bindir</span><span
                                class="method-args">(install_dir=Gem.dir)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path where gem executables are to be installed.</p>

                              <div class="method-source-code" id="bindir-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 301</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">bindir</span>(<span class="ruby-identifier">install_dir</span>=<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">dir</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">install_dir</span>, <span class="ruby-string">&quot;bin&quot;</span> <span class="ruby-keyword">unless</span>
    <span class="ruby-identifier">install_dir</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">default_dir</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">default_bindir</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-cache_home" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">cache_home</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path to standard location of the user’s cache directory.</p>

                              <div class="method-source-code" id="cache_home-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 147</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">cache_home</span>
  <span class="ruby-ivar">@cache_home</span> <span class="ruby-operator">||=</span> (<span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;XDG_CACHE_HOME&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_home</span>, <span class="ruby-string">&quot;.cache&quot;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-clear_default_specs" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">clear_default_specs</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Clear default gem related variables. It is for test</p>

                              <div class="method-source-code" id="clear_default_specs-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1217</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">clear_default_specs</span>
  <span class="ruby-ivar">@path_to_default_spec_map</span>.<span class="ruby-identifier">clear</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-clear_paths" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">clear_paths</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Reset the <code>dir</code> and <code>path</code> values.  The next time <code>dir</code> or <code>path</code> is requested, the values will be calculated from scratch.  This is mainly used by the unit tests to provide test isolation.</p>

                              <div class="method-source-code" id="clear_paths-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 319</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">clear_paths</span>
  <span class="ruby-ivar">@paths</span>         = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@user_home</span>     = <span class="ruby-keyword">nil</span>
  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">reset</span>
  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Security</span>.<span class="ruby-identifier">reset</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Security</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-config_file" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">config_file</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path to standard location of the user’s .gemrc file.</p>

                              <div class="method-source-code" id="config_file-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 133</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">config_file</span>
  <span class="ruby-ivar">@config_file</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">find_config_file</span>.<span class="ruby-identifier">tap</span>(<span class="ruby-operator">&amp;</span><span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">UNTAINT</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-config_home" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">config_home</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path to standard location of the user’s configuration directory.</p>

                              <div class="method-source-code" id="config_home-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 114</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">config_home</span>
  <span class="ruby-ivar">@config_home</span> <span class="ruby-operator">||=</span> (<span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;XDG_CONFIG_HOME&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_home</span>, <span class="ruby-string">&quot;.config&quot;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-configuration" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">configuration</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The standard configuration object for gems.</p>

                              <div class="method-source-code" id="configuration-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 329</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">configuration</span>
  <span class="ruby-ivar">@configuration</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">ConfigFile</span>.<span class="ruby-identifier">new</span> []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-configuration-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">configuration=</span><span
                                class="method-args">(config)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Use the given configuration object (which implements the <a href="Gem/ConfigFile.html"><code>ConfigFile</code></a> protocol) as the standard configuration object.</p>

                              <div class="method-source-code" id="configuration-3D-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 337</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">configuration=</span>(<span class="ruby-identifier">config</span>)
  <span class="ruby-ivar">@configuration</span> = <span class="ruby-identifier">config</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-data_home" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">data_home</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path to standard location of the user’s data directory.</p>

                              <div class="method-source-code" id="data_home-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 154</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">data_home</span>
  <span class="ruby-ivar">@data_home</span> <span class="ruby-operator">||=</span> (<span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;XDG_DATA_HOME&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_home</span>, <span class="ruby-string">&quot;.local&quot;</span>, <span class="ruby-string">&quot;share&quot;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_bindir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_bindir</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The default directory for binaries</p>

                              <div class="method-source-code" id="default_bindir-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 204</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_bindir</span>
  <span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;bindir&quot;</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_cert_path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_cert_path</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The default signing certificate chain path</p>

                              <div class="method-source-code" id="default_cert_path-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 228</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_cert_path</span>
  <span class="ruby-identifier">default_cert_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_home</span>, <span class="ruby-string">&quot;.gem&quot;</span>, <span class="ruby-string">&quot;gem-public_cert.pem&quot;</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">default_cert_path</span>)
    <span class="ruby-identifier">default_cert_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">data_home</span>, <span class="ruby-string">&quot;gem&quot;</span>, <span class="ruby-string">&quot;gem-public_cert.pem&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">default_cert_path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_dir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_dir</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Default home directory path to be used if an alternate value is not specified in the environment</p>

                              <div class="method-source-code" id="default_dir-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 37</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_dir</span>
  <span class="ruby-ivar">@default_dir</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;rubylibprefix&quot;</span>], <span class="ruby-string">&quot;gems&quot;</span>, <span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;ruby_version&quot;</span>])
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_exec_format" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_exec_format</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Deduce Ruby’s –program-prefix and –program-suffix from its install name</p>

                              <div class="method-source-code" id="default_exec_format-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 186</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_exec_format</span>
  <span class="ruby-identifier">exec_format</span> = <span class="ruby-keyword">begin</span>
                  <span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;ruby_install_name&quot;</span>].<span class="ruby-identifier">sub</span>(<span class="ruby-string">&quot;ruby&quot;</span>, <span class="ruby-string">&quot;%s&quot;</span>)
                <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span>
                  <span class="ruby-string">&quot;%s&quot;</span>
                <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">exec_format</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;%s&quot;</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Exception</span>,
      <span class="ruby-node">&quot;[BUG] invalid exec_format #{exec_format.inspect}, no %s&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">exec_format</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_ext_dir_for" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_ext_dir_for</span><span
                                class="method-args">(base_dir)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns binary extensions dir for specified RubyGems base dir or nil if such directory cannot be determined.</p>

<p>By default, the binary extensions are located side by side with their Ruby counterparts, therefore nil is returned</p>

                              <div class="method-source-code" id="default_ext_dir_for-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 48</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_ext_dir_for</span>(<span class="ruby-identifier">base_dir</span>)
  <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_key_path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_key_path</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The default signing key path</p>

                              <div class="method-source-code" id="default_key_path-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 215</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_key_path</span>
  <span class="ruby-identifier">default_key_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_home</span>, <span class="ruby-string">&quot;.gem&quot;</span>, <span class="ruby-string">&quot;gem-private_key.pem&quot;</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">default_key_path</span>)
    <span class="ruby-identifier">default_key_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">data_home</span>, <span class="ruby-string">&quot;gem&quot;</span>, <span class="ruby-string">&quot;gem-private_key.pem&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">default_key_path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_path</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Default gem load path</p>

                              <div class="method-source-code" id="default_path-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 175</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_path</span>
  <span class="ruby-identifier">path</span> = []
  <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">user_dir</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">user_home</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">user_home</span>)
  <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">default_dir</span>
  <span class="ruby-identifier">path</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">vendor_dir</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">vendor_dir</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">vendor_dir</span>)
  <span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_rubygems_dirs" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_rubygems_dirs</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Paths where RubyGems’ .rb files and bin files are installed</p>

                              <div class="method-source-code" id="default_rubygems_dirs-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 55</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_rubygems_dirs</span>
  <span class="ruby-keyword">nil</span> <span class="ruby-comment"># default to standard layout</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_sources" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_sources</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>An Array of the default sources that come with RubyGems</p>

                              <div class="method-source-code" id="default_sources-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 15</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_sources</span>
  <span class="ruby-node">%w[https://rubygems.org/]</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_spec_cache_dir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_spec_cache_dir</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Default spec directory path to be used if an alternate value is not specified in the environment</p>

                              <div class="method-source-code" id="default_spec_cache_dir-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_spec_cache_dir</span>
  <span class="ruby-identifier">default_spec_cache_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_home</span>, <span class="ruby-string">&quot;.gem&quot;</span>, <span class="ruby-string">&quot;specs&quot;</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">default_spec_cache_dir</span>)
    <span class="ruby-identifier">default_spec_cache_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">data_home</span>, <span class="ruby-string">&quot;gem&quot;</span>, <span class="ruby-string">&quot;specs&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">default_spec_cache_dir</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_specifications_dir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_specifications_dir</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Path to specification files of default gems.</p>

                              <div class="method-source-code" id="default_specifications_dir-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 62</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_specifications_dir</span>
  <span class="ruby-ivar">@default_specifications_dir</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">default_dir</span>, <span class="ruby-string">&quot;specifications&quot;</span>, <span class="ruby-string">&quot;default&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-deflate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">deflate</span><span
                                class="method-args">(data)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>A Zlib::Deflate.deflate wrapper</p>

                              <div class="method-source-code" id="deflate-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 344</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">deflate</span>(<span class="ruby-identifier">data</span>)
  <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;zlib&quot;</span>
  <span class="ruby-constant">Zlib</span><span class="ruby-operator">::</span><span class="ruby-constant">Deflate</span>.<span class="ruby-identifier">deflate</span> <span class="ruby-identifier">data</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-dir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">dir</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path where gems are to be installed.</p>

                              <div class="method-source-code" id="dir-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 392</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">dir</span>
  <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">home</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-done_installing" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">done_installing</span><span
                                class="method-args">(&amp;hook)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds a post-installs hook that will be passed a <a href="Gem/DependencyInstaller.html"><code>Gem::DependencyInstaller</code></a> and a list of installed specifications when <a href="Gem/DependencyInstaller.html#method-i-install"><code>Gem::DependencyInstaller#install</code></a> is complete</p>

                              <div class="method-source-code" id="done_installing-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 678</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">done_installing</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">hook</span>)
  <span class="ruby-ivar">@done_installing_hooks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">hook</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ensure_default_gem_subdirectories" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ensure_default_gem_subdirectories</span><span
                                class="method-args">(dir = Gem.dir, mode = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Quietly ensure the <a href="Gem.html"><code>Gem</code></a> directory <code>dir</code> contains all the proper subdirectories for handling default gems.  If we can’t create a directory due to a permission problem, then we will silently continue.</p>

<p>If <code>mode</code> is given, missing directories are created with this mode.</p>

<p>World-writable directories will never be created.</p>

                              <div class="method-source-code" id="ensure_default_gem_subdirectories-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 426</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">ensure_default_gem_subdirectories</span>(<span class="ruby-identifier">dir</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">mode</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">ensure_subdirectories</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-constant">REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ensure_gem_subdirectories" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ensure_gem_subdirectories</span><span
                                class="method-args">(dir = Gem.dir, mode = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Quietly ensure the <a href="Gem.html"><code>Gem</code></a> directory <code>dir</code> contains all the proper subdirectories.  If we can’t create a directory due to a permission problem, then we will silently continue.</p>

<p>If <code>mode</code> is given, missing directories are created with this mode.</p>

<p>World-writable directories will never be created.</p>

                              <div class="method-source-code" id="ensure_gem_subdirectories-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 413</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">ensure_gem_subdirectories</span>(<span class="ruby-identifier">dir</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">mode</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">ensure_subdirectories</span>(<span class="ruby-identifier">dir</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-constant">REPOSITORY_SUBDIRECTORIES</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-env_requirement" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">env_requirement</span><span
                                class="method-args">(gem_name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="env_requirement-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 811</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">env_requirement</span>(<span class="ruby-identifier">gem_name</span>)
  <span class="ruby-ivar">@env_requirements_by_name</span> <span class="ruby-operator">||=</span> {}
  <span class="ruby-ivar">@env_requirements_by_name</span>[<span class="ruby-identifier">gem_name</span>] <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">req</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-node">&quot;GEM_REQUIREMENT_#{gem_name.upcase}&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-string">&quot;&gt;= 0&quot;</span>
    <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Requirement</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">req</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-find_config_file" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">find_config_file</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Finds the user’s config file</p>

                              <div class="method-source-code" id="find_config_file-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 121</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">find_config_file</span>
  <span class="ruby-identifier">gemrc</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_home</span>, <span class="ruby-string">&quot;.gemrc&quot;</span>
  <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">gemrc</span>
    <span class="ruby-identifier">gemrc</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">config_home</span>, <span class="ruby-string">&quot;gem&quot;</span>, <span class="ruby-string">&quot;gemrc&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-find_files" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">find_files</span><span
                                class="method-args">(glob, check_load_path=true)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a list of paths matching <code>glob</code> that can be used by a gem to pick up features from other gems.  For example:</p>

<pre class="ruby"><span class="ruby-constant">Gem</span>.<span class="ruby-identifier">find_files</span>(<span class="ruby-string">&#39;rdoc/discover&#39;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span> <span class="ruby-identifier">load</span> <span class="ruby-identifier">path</span> <span class="ruby-keyword">end</span>
</pre>

<p>if <code>check_load_path</code> is true (the default), then <a href="Gem.html#method-c-find_files"><code>find_files</code></a> also searches $LOAD_PATH for files as well as gems.</p>

<p>Note that <a href="Gem.html#method-c-find_files"><code>find_files</code></a> will return all files even if they are from different versions of the same gem.  See also <a href="Gem.html#method-c-find_latest_files"><code>find_latest_files</code></a></p>

                              <div class="method-source-code" id="find_files-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 477</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">find_files</span>(<span class="ruby-identifier">glob</span>, <span class="ruby-identifier">check_load_path</span>=<span class="ruby-keyword">true</span>)
  <span class="ruby-identifier">files</span> = []

  <span class="ruby-identifier">files</span> = <span class="ruby-identifier">find_files_from_load_path</span> <span class="ruby-identifier">glob</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">check_load_path</span>

  <span class="ruby-identifier">gem_specifications</span> = <span class="ruby-ivar">@gemdeps</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">loaded_specs</span>.<span class="ruby-identifier">values</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">stubs</span>

  <span class="ruby-identifier">files</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">gem_specifications</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">matches_for_glob</span>(<span class="ruby-node">&quot;#{glob}#{Gem.suffix_pattern}&quot;</span>)
  }.<span class="ruby-identifier">flatten</span>

  <span class="ruby-comment"># $LOAD_PATH might contain duplicate entries or reference</span>
  <span class="ruby-comment"># the spec dirs directly, so we prune.</span>
  <span class="ruby-identifier">files</span>.<span class="ruby-identifier">uniq!</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">check_load_path</span>

  <span class="ruby-identifier">files</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-find_latest_files" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">find_latest_files</span><span
                                class="method-args">(glob, check_load_path=true)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a list of paths matching <code>glob</code> from the latest gems that can be used by a gem to pick up features from other gems.  For example:</p>

<pre class="ruby"><span class="ruby-constant">Gem</span>.<span class="ruby-identifier">find_latest_files</span>(<span class="ruby-string">&#39;rdoc/discover&#39;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span> <span class="ruby-identifier">load</span> <span class="ruby-identifier">path</span> <span class="ruby-keyword">end</span>
</pre>

<p>if <code>check_load_path</code> is true (the default), then <a href="Gem.html#method-c-find_latest_files"><code>find_latest_files</code></a> also searches $LOAD_PATH for files as well as gems.</p>

<p>Unlike <a href="Gem.html#method-c-find_files"><code>find_files</code></a>, <a href="Gem.html#method-c-find_latest_files"><code>find_latest_files</code></a> will return only files from the latest version of a gem.</p>

                              <div class="method-source-code" id="find_latest_files-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 514</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">find_latest_files</span>(<span class="ruby-identifier">glob</span>, <span class="ruby-identifier">check_load_path</span>=<span class="ruby-keyword">true</span>)
  <span class="ruby-identifier">files</span> = []

  <span class="ruby-identifier">files</span> = <span class="ruby-identifier">find_files_from_load_path</span> <span class="ruby-identifier">glob</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">check_load_path</span>

  <span class="ruby-identifier">files</span>.<span class="ruby-identifier">concat</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">latest_specs</span>(<span class="ruby-keyword">true</span>).<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">matches_for_glob</span>(<span class="ruby-node">&quot;#{glob}#{Gem.suffix_pattern}&quot;</span>)
  }.<span class="ruby-identifier">flatten</span>

  <span class="ruby-comment"># $LOAD_PATH might contain duplicate entries or reference</span>
  <span class="ruby-comment"># the spec dirs directly, so we prune.</span>
  <span class="ruby-identifier">files</span>.<span class="ruby-identifier">uniq!</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">check_load_path</span>

  <span class="ruby-identifier">files</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-find_unresolved_default_spec" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">find_unresolved_default_spec</span><span
                                class="method-args">(path)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Find a <a href="Gem/Specification.html"><code>Gem::Specification</code></a> of default gem from <code>path</code></p>

                              <div class="method-source-code" id="find_unresolved_default_spec-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1209</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">find_unresolved_default_spec</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-identifier">default_spec</span> = <span class="ruby-ivar">@path_to_default_spec_map</span>[<span class="ruby-identifier">path</span>]
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">default_spec</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">default_spec</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">loaded_specs</span>[<span class="ruby-identifier">default_spec</span>.<span class="ruby-identifier">name</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">default_spec</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-finish_resolve" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">finish_resolve</span><span
                                class="method-args">(request_set=Gem::RequestSet.new)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="finish_resolve-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 225</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">finish_resolve</span>(<span class="ruby-identifier">request_set</span>=<span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">RequestSet</span>.<span class="ruby-identifier">new</span>)
  <span class="ruby-identifier">request_set</span>.<span class="ruby-identifier">import</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">unresolved_deps</span>.<span class="ruby-identifier">values</span>
  <span class="ruby-identifier">request_set</span>.<span class="ruby-identifier">import</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">loaded_specs</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Dependency</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">s</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">s</span>.<span class="ruby-identifier">version</span>) }

  <span class="ruby-identifier">request_set</span>.<span class="ruby-identifier">resolve_current</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">s</span>.<span class="ruby-identifier">full_spec</span>.<span class="ruby-identifier">activate</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-host" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">host</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Get the default RubyGems API host. This is normally <code>https://rubygems.org</code>.</p>

                              <div class="method-source-code" id="host-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 549</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">host</span>
  <span class="ruby-ivar">@host</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_HOST</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-host-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">host=</span><span
                                class="method-args">(host)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the default RubyGems API host.</p>

                              <div class="method-source-code" id="host-3D-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 555</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">host=</span>(<span class="ruby-identifier">host</span>)
  <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-install" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">install</span><span
                                class="method-args">(name, version = Gem::Requirement.default, *options)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Top level install helper method. Allows you to install gems interactively:</p>

<pre>% irb
&gt;&gt; Gem.install &quot;minitest&quot;
Fetching: minitest-5.14.0.gem (100%)
=&gt; [#&lt;Gem::Specification:0x1013b4528 @name=&quot;minitest&quot;, ...&gt;]</pre>

                              <div class="method-source-code" id="install-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 538</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">install</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">version</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Requirement</span>.<span class="ruby-identifier">default</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">require_relative</span> <span class="ruby-string">&quot;rubygems/dependency_installer&quot;</span>
  <span class="ruby-identifier">inst</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">DependencyInstaller</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">inst</span>.<span class="ruby-identifier">install</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">version</span>
  <span class="ruby-identifier">inst</span>.<span class="ruby-identifier">installed_gems</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-java_platform-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">java_platform?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Is this a java platform?</p>

                              <div class="method-source-code" id="java_platform-3F-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 992</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">java_platform?</span>
  <span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;java&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-latest_rubygems_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">latest_rubygems_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the latest release version of RubyGems.</p>

                              <div class="method-source-code" id="latest_rubygems_version-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 836</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">latest_rubygems_version</span>
  <span class="ruby-identifier">latest_version_for</span>(<span class="ruby-string">&quot;rubygems-update&quot;</span>) <span class="ruby-operator">||</span>
    <span class="ruby-identifier">raise</span>(<span class="ruby-string">&quot;Can&#39;t find &#39;rubygems-update&#39; in any repo. Check `gem source list`.&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-latest_spec_for" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">latest_spec_for</span><span
                                class="method-args">(name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the latest release-version specification for the gem <code>name</code>.</p>

                              <div class="method-source-code" id="latest_spec_for-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 823</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">latest_spec_for</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">dependency</span>   = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Dependency</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">name</span>
  <span class="ruby-identifier">fetcher</span>      = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">SpecFetcher</span>.<span class="ruby-identifier">fetcher</span>
  <span class="ruby-identifier">spec_tuples</span>, = <span class="ruby-identifier">fetcher</span>.<span class="ruby-identifier">spec_for_dependency</span> <span class="ruby-identifier">dependency</span>

  <span class="ruby-identifier">spec</span>, = <span class="ruby-identifier">spec_tuples</span>.<span class="ruby-identifier">last</span>

  <span class="ruby-identifier">spec</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-latest_version_for" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">latest_version_for</span><span
                                class="method-args">(name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the version of the latest release-version of gem <code>name</code></p>

                              <div class="method-source-code" id="latest_version_for-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 844</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">latest_version_for</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">latest_spec_for</span>(<span class="ruby-identifier">name</span>)&amp;.<span class="ruby-identifier">version</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-load_env_plugins" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">load_env_plugins</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Find all ‘rubygems_plugin’ files in $LOAD_PATH and load them</p>

                              <div class="method-source-code" id="load_env_plugins-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1034</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">load_env_plugins</span>
  <span class="ruby-identifier">load_plugin_files</span> <span class="ruby-identifier">find_files_from_load_path</span>(<span class="ruby-string">&quot;rubygems_plugin&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-load_path_insert_index" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">load_path_insert_index</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The index to insert activated gem paths into the $LOAD_PATH. The activated gem’s paths are inserted before site lib directory by default.</p>

                              <div class="method-source-code" id="load_path_insert_index-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 563</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">load_path_insert_index</span>
  <span class="ruby-identifier">$LOAD_PATH</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">instance_variable_defined?</span>(<span class="ruby-value">:@gem_prelude_index</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">index</span> = <span class="ruby-identifier">$LOAD_PATH</span>.<span class="ruby-identifier">index</span> <span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;sitelibdir&quot;</span>]

  <span class="ruby-identifier">index</span> <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-load_plugins" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">load_plugins</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Find rubygems plugin files in the standard location and load them</p>

                              <div class="method-source-code" id="load_plugins-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1025</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">load_plugins</span>
  <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">gem_path</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">load_plugin_files</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">glob_files_in_dir</span>(<span class="ruby-node">&quot;*#{Gem.plugin_suffix_pattern}&quot;</span>, <span class="ruby-identifier">plugindir</span>(<span class="ruby-identifier">gem_path</span>))
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-load_yaml" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">load_yaml</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Loads YAML, preferring Psych</p>

                              <div class="method-source-code" id="load_yaml-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 596</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">load_yaml</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@yaml_loaded</span>

  <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;psych&quot;</span>
  <span class="ruby-identifier">require_relative</span> <span class="ruby-string">&quot;rubygems/psych_tree&quot;</span>

  <span class="ruby-identifier">require_relative</span> <span class="ruby-string">&quot;rubygems/safe_yaml&quot;</span>

  <span class="ruby-ivar">@yaml_loaded</span> = <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-location_of_caller" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">location_of_caller</span><span
                                class="method-args">(depth = 1)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The file name and line number of the caller of the caller of this method.</p>

<p><code>depth</code> is how many layers up the call stack it should go.</p>

<p>e.g.,</p>

<p>def a; <a href="Gem.html#method-c-location_of_caller"><code>Gem.location_of_caller</code></a>; end a #=&gt; [“x.rb”, 2]  # (it’ll vary depending on file name and line number)</p>

<p>def b; c; end def c; <a href="Gem.html#method-c-location_of_caller"><code>Gem.location_of_caller(2)</code></a>; end b #=&gt; [“x.rb”, 6]  # (it’ll vary depending on file name and line number)</p>

                              <div class="method-source-code" id="location_of_caller-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 621</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">location_of_caller</span>(<span class="ruby-identifier">depth</span> = <span class="ruby-value">1</span>)
  <span class="ruby-identifier">caller</span>[<span class="ruby-identifier">depth</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp">/(.*?):(\d+).*?$/i</span>
  <span class="ruby-identifier">file</span> = <span class="ruby-node">$1</span>
  <span class="ruby-identifier">lineno</span> = <span class="ruby-node">$2</span>.<span class="ruby-identifier">to_i</span>

  [<span class="ruby-identifier">file</span>, <span class="ruby-identifier">lineno</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-marshal_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">marshal_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The version of the Marshal format for your Ruby.</p>

                              <div class="method-source-code" id="marshal_version-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 632</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">marshal_version</span>
  <span class="ruby-node">&quot;#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-needs" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">needs</span><span
                                class="method-args">() { |rs| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="needs-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 217</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">needs</span>
  <span class="ruby-identifier">rs</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">RequestSet</span>.<span class="ruby-identifier">new</span>

  <span class="ruby-keyword">yield</span> <span class="ruby-identifier">rs</span>

  <span class="ruby-identifier">finish_resolve</span> <span class="ruby-identifier">rs</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-open_file" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">open_file</span><span
                                class="method-args">(path, flags) { |io| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Open a file with given flags, and on Windows protect access with flock</p>

                              <div class="method-source-code" id="open_file-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 771</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">open_file</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">flags</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">flags</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">java_platform?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">win_platform?</span>
      <span class="ruby-keyword">begin</span>
        <span class="ruby-identifier">io</span>.<span class="ruby-identifier">flock</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">LOCK_EX</span>)
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOSYS</span>, <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOTSUP</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-identifier">io</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOLCK</span> <span class="ruby-comment"># NFS</span>
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">main</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>
    <span class="ruby-identifier">raise</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">flags</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">yield</span> <span class="ruby-identifier">io</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-operating_system_defaults" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">operating_system_defaults</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Default options for gem commands for Ruby packagers.</p>

<p>The options here should be structured as an array of string “gem” command names as keys and a string of the default options as values.</p>

<p>Example:</p>

<p>def self.operating_system_defaults</p>

<pre class="ruby">{
    <span class="ruby-string">&#39;install&#39;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&#39;--no-rdoc --no-ri --env-shebang&#39;</span>,
    <span class="ruby-string">&#39;update&#39;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&#39;--no-rdoc --no-ri --env-shebang&#39;</span>
}
</pre>

<p>end</p>

                              <div class="method-source-code" id="operating_system_defaults-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 274</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">operating_system_defaults</span>
  {}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">path</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="path-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 396</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">path</span>
  <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-path_separator" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">path_separator</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>How String <a href="Gem.html"><code>Gem</code></a> paths should be split.  Overridable for esoteric platforms.</p>

                              <div class="method-source-code" id="path_separator-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 168</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">path_separator</span>
  <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_SEPARATOR</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-paths" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">paths</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Retrieve the <a href="Gem/PathSupport.html"><code>PathSupport</code></a> object that RubyGems uses to lookup files.</p>

                              <div class="method-source-code" id="paths-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 352</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">paths</span>
  <span class="ruby-ivar">@paths</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">PathSupport</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">ENV</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-paths-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">paths=</span><span
                                class="method-args">(env)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Initialize the filesystem paths to use from <code>env</code>. <code>env</code> is a hash-like object (typically ENV) that is queried for ‘GEM_HOME’, ‘GEM_PATH’, and ‘GEM_SPEC_CACHE’ Keys for the <code>env</code> hash should be Strings, and values of the hash should be Strings or <code>nil</code>.</p>

                              <div class="method-source-code" id="paths-3D-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 362</span>
  <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">paths=</span>(<span class="ruby-identifier">env</span>)
    <span class="ruby-identifier">clear_paths</span>
    <span class="ruby-identifier">target</span> = {}
    <span class="ruby-identifier">env</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">k</span>
      <span class="ruby-keyword">when</span> <span class="ruby-string">&quot;GEM_HOME&quot;</span>, <span class="ruby-string">&quot;GEM_PATH&quot;</span>, <span class="ruby-string">&quot;GEM_SPEC_CACHE&quot;</span>
        <span class="ruby-keyword">case</span> <span class="ruby-identifier">v</span>
        <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>, <span class="ruby-constant">String</span>
          <span class="ruby-identifier">target</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
          <span class="ruby-keyword">unless</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecate</span>.<span class="ruby-identifier">skip</span>
            <span class="ruby-identifier">warn</span> <span class="ruby-identifier">&lt;&lt;-EOWARN</span>
<span class="ruby-value">Array values in the parameter to `Gem.paths=` are deprecated.
Please use a String or nil.
An Array (#{env.inspect}) was passed in from #{caller[3]}
</span><span class="ruby-identifier">            EOWARN</span>
          <span class="ruby-keyword">end</span>
          <span class="ruby-identifier">target</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">join</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_SEPARATOR</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">target</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-ivar">@paths</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">PathSupport</span>.<span class="ruby-identifier">new</span> <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">to_hash</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">target</span>)
    <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">dirs</span> = <span class="ruby-ivar">@paths</span>.<span class="ruby-identifier">path</span>
  <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-platform_defaults" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">platform_defaults</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Default options for gem commands for Ruby implementers.</p>

<p>The options here should be structured as an array of string “gem” command names as keys and a string of the default options as values.</p>

<p>Example:</p>

<p>def self.platform_defaults</p>

<pre class="ruby">{
    <span class="ruby-string">&#39;install&#39;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&#39;--no-rdoc --no-ri --env-shebang&#39;</span>,
    <span class="ruby-string">&#39;update&#39;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&#39;--no-rdoc --no-ri --env-shebang&#39;</span>
}
</pre>

<p>end</p>

                              <div class="method-source-code" id="platform_defaults-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 293</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">platform_defaults</span>
  {}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-platforms" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">platforms</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Array of platforms this RubyGems supports.</p>

                              <div class="method-source-code" id="platforms-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 646</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">platforms</span>
  <span class="ruby-ivar">@platforms</span> <span class="ruby-operator">||=</span> []
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@platforms</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-ivar">@platforms</span> = [<span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Platform</span><span class="ruby-operator">::</span><span class="ruby-constant">RUBY</span>, <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Platform</span>.<span class="ruby-identifier">local</span>]
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@platforms</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-platforms-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">platforms=</span><span
                                class="method-args">(platforms)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set array of platforms this RubyGems supports (primarily for testing).</p>

                              <div class="method-source-code" id="platforms-3D-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 639</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">platforms=</span>(<span class="ruby-identifier">platforms</span>)
  <span class="ruby-ivar">@platforms</span> = <span class="ruby-identifier">platforms</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-plugin_suffix_pattern" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">plugin_suffix_pattern</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Glob pattern for require-able plugin suffixes.</p>

                              <div class="method-source-code" id="plugin_suffix_pattern-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 916</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">plugin_suffix_pattern</span>
  <span class="ruby-ivar">@plugin_suffix_pattern</span> <span class="ruby-operator">||=</span> <span class="ruby-node">&quot;_plugin#{suffix_pattern}&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-plugin_suffix_regexp" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">plugin_suffix_regexp</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Regexp for require-able plugin suffixes.</p>

                              <div class="method-source-code" id="plugin_suffix_regexp-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 923</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">plugin_suffix_regexp</span>
  <span class="ruby-ivar">@plugin_suffix_regexp</span> <span class="ruby-operator">||=</span> <span class="ruby-regexp">/_plugin#{suffix_regexp}\z/</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-plugindir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">plugindir</span><span
                                class="method-args">(install_dir=Gem.dir)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path were rubygems plugins are to be installed.</p>

                              <div class="method-source-code" id="plugindir-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 310</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">plugindir</span>(<span class="ruby-identifier">install_dir</span>=<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">dir</span>)
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">install_dir</span>, <span class="ruby-string">&quot;plugins&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-post_build" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">post_build</span><span
                                class="method-args">(&amp;hook)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds a post-build hook that will be passed an <a href="Gem/Installer.html"><code>Gem::Installer</code></a> instance when <a href="Gem/Installer.html#method-i-install"><code>Gem::Installer#install</code></a> is called.  The hook is called after the gem has been extracted and extensions have been built but before the executables or gemspec has been written.  If the hook returns <code>false</code> then the gem’s files will be removed and the install will be aborted.</p>

                              <div class="method-source-code" id="post_build-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 661</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">post_build</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">hook</span>)
  <span class="ruby-ivar">@post_build_hooks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">hook</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-post_install" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">post_install</span><span
                                class="method-args">(&amp;hook)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds a post-install hook that will be passed an <a href="Gem/Installer.html"><code>Gem::Installer</code></a> instance when <a href="Gem/Installer.html#method-i-install"><code>Gem::Installer#install</code></a> is called</p>

                              <div class="method-source-code" id="post_install-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 669</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">post_install</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">hook</span>)
  <span class="ruby-ivar">@post_install_hooks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">hook</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-post_reset" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">post_reset</span><span
                                class="method-args">(&amp;hook)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds a hook that will get run after <a href="Gem/Specification.html#method-c-reset"><code>Gem::Specification.reset</code></a> is run.</p>

                              <div class="method-source-code" id="post_reset-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 686</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">post_reset</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">hook</span>)
  <span class="ruby-ivar">@post_reset_hooks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">hook</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-post_uninstall" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">post_uninstall</span><span
                                class="method-args">(&amp;hook)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds a post-uninstall hook that will be passed a <a href="Gem/Uninstaller.html"><code>Gem::Uninstaller</code></a> instance and the spec that was uninstalled when <a href="Gem/Uninstaller.html#method-i-uninstall"><code>Gem::Uninstaller#uninstall</code></a> is called</p>

                              <div class="method-source-code" id="post_uninstall-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 695</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">post_uninstall</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">hook</span>)
  <span class="ruby-ivar">@post_uninstall_hooks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">hook</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-pre_install" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">pre_install</span><span
                                class="method-args">(&amp;hook)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds a pre-install hook that will be passed an <a href="Gem/Installer.html"><code>Gem::Installer</code></a> instance when <a href="Gem/Installer.html#method-i-install"><code>Gem::Installer#install</code></a> is called.  If the hook returns <code>false</code> then the install will be aborted.</p>

                              <div class="method-source-code" id="pre_install-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 704</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">pre_install</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">hook</span>)
  <span class="ruby-ivar">@pre_install_hooks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">hook</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-pre_reset" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">pre_reset</span><span
                                class="method-args">(&amp;hook)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds a hook that will get run before <a href="Gem/Specification.html#method-c-reset"><code>Gem::Specification.reset</code></a> is run.</p>

                              <div class="method-source-code" id="pre_reset-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 712</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">pre_reset</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">hook</span>)
  <span class="ruby-ivar">@pre_reset_hooks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">hook</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-pre_uninstall" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">pre_uninstall</span><span
                                class="method-args">(&amp;hook)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds a pre-uninstall hook that will be passed an <a href="Gem/Uninstaller.html"><code>Gem::Uninstaller</code></a> instance and the spec that will be uninstalled when <a href="Gem/Uninstaller.html#method-i-uninstall"><code>Gem::Uninstaller#uninstall</code></a> is called</p>

                              <div class="method-source-code" id="pre_uninstall-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 721</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">pre_uninstall</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">hook</span>)
  <span class="ruby-ivar">@pre_uninstall_hooks</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">hook</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-prefix" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">prefix</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The directory prefix this RubyGems was installed at. If your prefix is in a standard location (ie, rubygems is installed where you’d expect it to be), then prefix returns nil.</p>

                              <div class="method-source-code" id="prefix-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 730</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">prefix</span>
  <span class="ruby-identifier">prefix</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span> <span class="ruby-constant">RUBYGEMS_DIR</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">prefix</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;sitelibdir&quot;</span>]) <span class="ruby-operator">&amp;&amp;</span>
     <span class="ruby-identifier">prefix</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;libdir&quot;</span>]) <span class="ruby-operator">&amp;&amp;</span>
     <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-constant">RUBYGEMS_DIR</span>) <span class="ruby-operator">==</span> <span class="ruby-string">&quot;lib&quot;</span>
    <span class="ruby-identifier">prefix</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-read_binary" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">read_binary</span><span
                                class="method-args">(path)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Safely read a file in binary mode on all platforms.</p>

                              <div class="method-source-code" id="read_binary-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 750</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">read_binary</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-identifier">open_file</span>(<span class="ruby-identifier">path</span>, <span class="ruby-string">&quot;rb+&quot;</span>, <span class="ruby-operator">&amp;</span><span class="ruby-value">:read</span>)
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EACCES</span>, <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EROFS</span>
  <span class="ruby-identifier">open_file</span>(<span class="ruby-identifier">path</span>, <span class="ruby-string">&quot;rb&quot;</span>, <span class="ruby-operator">&amp;</span><span class="ruby-value">:read</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-refresh" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">refresh</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Refresh available gems from disk.</p>

                              <div class="method-source-code" id="refresh-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 743</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">refresh</span>
  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">reset</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-register_default_spec" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">register_default_spec</span><span
                                class="method-args">(spec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Register a <a href="Gem/Specification.html"><code>Gem::Specification</code></a> for default gem.</p>

<p>Two formats for the specification are supported:</p>
<ul><li>
<p>MRI 2.0 style, where spec.files contains unprefixed require names. The spec’s filenames will be registered as-is.</p>
</li><li>
<p>New style, where spec.files contains files prefixed with paths from spec.require_paths. The prefixes are stripped before registering the spec’s filenames. Unprefixed files are omitted.</p>
</li></ul>

                              <div class="method-source-code" id="register_default_spec-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1184</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">register_default_spec</span>(<span class="ruby-identifier">spec</span>)
  <span class="ruby-identifier">extended_require_paths</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">require_paths</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;/&quot;</span> }
  <span class="ruby-identifier">new_format</span> = <span class="ruby-identifier">extended_require_paths</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">files</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">start_with?</span> <span class="ruby-identifier">path</span> } }

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">new_format</span>
    <span class="ruby-identifier">prefix_group</span> = <span class="ruby-identifier">extended_require_paths</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;|&quot;</span>)
    <span class="ruby-identifier">prefix_pattern</span> = <span class="ruby-regexp">/^(#{prefix_group})/</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">new_format</span>
      <span class="ruby-identifier">file</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-identifier">prefix_pattern</span>, <span class="ruby-string">&quot;&quot;</span>)
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">$~</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">activate</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">already_loaded?</span>(<span class="ruby-identifier">file</span>)

    <span class="ruby-ivar">@path_to_default_spec_map</span>[<span class="ruby-identifier">file</span>] = <span class="ruby-identifier">spec</span>
    <span class="ruby-ivar">@path_to_default_spec_map</span>[<span class="ruby-identifier">file</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-identifier">suffix_regexp</span>, <span class="ruby-string">&quot;&quot;</span>)] = <span class="ruby-identifier">spec</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ruby" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ruby</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path to the running Ruby interpreter.</p>

                              <div class="method-source-code" id="ruby-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 794</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">ruby</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@ruby</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-ivar">@ruby</span> = <span class="ruby-constant">RbConfig</span>.<span class="ruby-identifier">ruby</span>

    <span class="ruby-ivar">@ruby</span> = <span class="ruby-node">&quot;\&quot;#{@ruby}\&quot;&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\s/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-ivar">@ruby</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@ruby</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ruby_api_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ruby_api_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a String containing the API compatibility version of Ruby</p>

                              <div class="method-source-code" id="ruby_api_version-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 807</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">ruby_api_version</span>
  <span class="ruby-ivar">@ruby_api_version</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;ruby_version&quot;</span>].<span class="ruby-identifier">dup</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ruby_engine" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ruby_engine</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ruby_engine-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 208</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">ruby_engine</span>
  <span class="ruby-constant">RUBY_ENGINE</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ruby_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ruby_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>A <a href="Gem/Version.html"><code>Gem::Version</code></a> for the currently running Ruby.</p>

                              <div class="method-source-code" id="ruby_version-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 851</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">ruby_version</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@ruby_version</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span> <span class="ruby-ivar">@ruby_version</span>
  <span class="ruby-identifier">version</span> = <span class="ruby-constant">RUBY_VERSION</span>.<span class="ruby-identifier">dup</span>

  <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_PATCHLEVEL</span> <span class="ruby-operator">==</span> <span class="ruby-value">-1</span>
    <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_ENGINE</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;ruby&quot;</span>
      <span class="ruby-identifier">desc</span> = <span class="ruby-constant">RUBY_DESCRIPTION</span>[<span class="ruby-regexp">/\Aruby #{Regexp.quote(RUBY_VERSION)}([^ ]+) /</span>, <span class="ruby-value">1</span>]
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">desc</span> = <span class="ruby-constant">RUBY_DESCRIPTION</span>[<span class="ruby-regexp">/\A#{RUBY_ENGINE} #{Regexp.quote(RUBY_ENGINE_VERSION)} \(#{RUBY_VERSION}([^ ]+)\) /</span>, <span class="ruby-value">1</span>]
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">version</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;.#{desc}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">desc</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@ruby_version</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">version</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-rubygems_version" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">rubygems_version</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>A <a href="Gem/Version.html"><code>Gem::Version</code></a> for the currently running RubyGems</p>

                              <div class="method-source-code" id="rubygems_version-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 870</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">rubygems_version</span>
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@rubygems_version</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span> <span class="ruby-ivar">@rubygems_version</span>
  <span class="ruby-ivar">@rubygems_version</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Version</span>.<span class="ruby-identifier">new</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-solaris_platform-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">solaris_platform?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Is this platform Solaris?</p>

                              <div class="method-source-code" id="solaris_platform-3F-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 999</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">solaris_platform?</span>
  <span class="ruby-constant">RUBY_PLATFORM</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;solaris&quot;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-source_date_epoch" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">source_date_epoch</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the value of <a href="Gem.html#method-c-source_date_epoch_string"><code>Gem.source_date_epoch_string</code></a>, as a Time object.</p>

<p>This is used throughout RubyGems for enabling reproducible builds.</p>

                              <div class="method-source-code" id="source_date_epoch-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1139</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">source_date_epoch</span>
  <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">source_date_epoch_string</span>.<span class="ruby-identifier">to_i</span>).<span class="ruby-identifier">utc</span>.<span class="ruby-identifier">freeze</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-source_date_epoch_string" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">source_date_epoch_string</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>If the SOURCE_DATE_EPOCH environment variable is set, returns it’s value. Otherwise, returns the time that <code>Gem.source_date_epoch_string</code> was first called in the same format as SOURCE_DATE_EPOCH.</p>

<p>NOTE(@duckinator): The implementation is a tad weird because we want to:</p>

<pre>1. Make builds reproducible by default, by having this function always
   return the same result during a given run.
2. Allow changing ENV[&#39;SOURCE_DATE_EPOCH&#39;] at runtime, since multiple
   tests that set this variable will be run in a single process.</pre>

<p>If you simplify this function and a lot of tests fail, that is likely due to #2 above.</p>

<p>Details on SOURCE_DATE_EPOCH: <a href="https://reproducible-builds.org/specs/source-date-epoch">reproducible-builds.org/specs/source-date-epoch</a>/</p>

                              <div class="method-source-code" id="source_date_epoch_string-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1120</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">source_date_epoch_string</span>
  <span class="ruby-comment"># The value used if $SOURCE_DATE_EPOCH is not set.</span>
  <span class="ruby-ivar">@default_source_date_epoch</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_s</span>

  <span class="ruby-identifier">specified_epoch</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;SOURCE_DATE_EPOCH&quot;</span>]

  <span class="ruby-comment"># If it&#39;s empty or just whitespace, treat it like it wasn&#39;t set at all.</span>
  <span class="ruby-identifier">specified_epoch</span> = <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">specified_epoch</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">specified_epoch</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">epoch</span> = <span class="ruby-identifier">specified_epoch</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@default_source_date_epoch</span>

  <span class="ruby-identifier">epoch</span>.<span class="ruby-identifier">strip</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-sources" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">sources</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns an Array of sources to fetch remote gems from. Uses <a href="Gem.html#method-c-default_sources"><code>default_sources</code></a> if the sources list is empty.</p>

                              <div class="method-source-code" id="sources-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 879</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">sources</span>
  <span class="ruby-identifier">source_list</span> = <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">sources</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">default_sources</span>
  <span class="ruby-ivar">@sources</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">SourceList</span>.<span class="ruby-identifier">from</span>(<span class="ruby-identifier">source_list</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-sources-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">sources=</span><span
                                class="method-args">(new_sources)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Need to be able to set the sources without calling <a href="Gem.html#method-c-sources"><code>Gem.sources</code></a>.replace since that would cause an infinite loop.</p>

<p>DOC: This comment is not documentation about the method itself, it’s more of a code comment about the implementation.</p>

                              <div class="method-source-code" id="sources-3D-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 891</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">sources=</span>(<span class="ruby-identifier">new_sources</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">new_sources</span>
    <span class="ruby-ivar">@sources</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@sources</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">SourceList</span>.<span class="ruby-identifier">from</span>(<span class="ruby-identifier">new_sources</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-spec_cache_dir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">spec_cache_dir</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="spec_cache_dir-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 400</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">spec_cache_dir</span>
  <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">spec_cache_dir</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-state_file" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">state_file</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path to standard location of the user’s state file.</p>

                              <div class="method-source-code" id="state_file-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 140</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">state_file</span>
  <span class="ruby-ivar">@state_file</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">state_home</span>, <span class="ruby-string">&quot;gem&quot;</span>, <span class="ruby-string">&quot;last_update_check&quot;</span>).<span class="ruby-identifier">tap</span>(<span class="ruby-operator">&amp;</span><span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">UNTAINT</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-state_home" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">state_home</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The path to standard location of the user’s state directory.</p>

                              <div class="method-source-code" id="state_home-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 161</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">state_home</span>
  <span class="ruby-ivar">@state_home</span> <span class="ruby-operator">||=</span> (<span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;XDG_STATE_HOME&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_home</span>, <span class="ruby-string">&quot;.local&quot;</span>, <span class="ruby-string">&quot;state&quot;</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-suffix_pattern" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">suffix_pattern</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Glob pattern for require-able path suffixes.</p>

                              <div class="method-source-code" id="suffix_pattern-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 902</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">suffix_pattern</span>
  <span class="ruby-ivar">@suffix_pattern</span> <span class="ruby-operator">||=</span> <span class="ruby-node">&quot;{#{suffixes.join(&quot;,&quot;)}}&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-suffix_regexp" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">suffix_regexp</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Regexp for require-able path suffixes.</p>

                              <div class="method-source-code" id="suffix_regexp-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 909</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">suffix_regexp</span>
  <span class="ruby-ivar">@suffix_regexp</span> <span class="ruby-operator">||=</span> <span class="ruby-regexp">/#{Regexp.union(suffixes)}\z/</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-suffixes" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">suffixes</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Suffixes for require-able paths.</p>

                              <div class="method-source-code" id="suffixes-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 930</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">suffixes</span>
  <span class="ruby-ivar">@suffixes</span> <span class="ruby-operator">||=</span> [<span class="ruby-string">&quot;&quot;</span>,
                 <span class="ruby-string">&quot;.rb&quot;</span>,
                 <span class="ruby-operator">*</span><span class="ruby-node">%w[DLEXT DLEXT2]</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
                   <span class="ruby-identifier">val</span> = <span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-identifier">key</span>]
                   <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">val</span>.<span class="ruby-identifier">empty?</span>
                   <span class="ruby-node">&quot;.#{val}&quot;</span>
                 <span class="ruby-keyword">end</span>].<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">uniq</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-time" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">time</span><span
                                class="method-args">(msg, width = 0, display = Gem.configuration.verbose) { || ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Prints the amount of time the supplied block takes to run using the debug UI output.</p>

                              <div class="method-source-code" id="time-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 944</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">time</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">width</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">display</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">verbose</span>)
  <span class="ruby-identifier">now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>

  <span class="ruby-identifier">value</span> = <span class="ruby-keyword">yield</span>

  <span class="ruby-identifier">elapsed</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">now</span>

  <span class="ruby-identifier">ui</span>.<span class="ruby-identifier">say</span> <span class="ruby-identifier">format</span>(<span class="ruby-string">&quot;%2$*1$s: %3$3.3fs&quot;</span>, <span class="ruby-operator">-</span><span class="ruby-identifier">width</span>, <span class="ruby-identifier">msg</span>, <span class="ruby-identifier">elapsed</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">display</span>

  <span class="ruby-identifier">value</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-try_activate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">try_activate</span><span
                                class="method-args">(path)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Try to activate a gem containing <code>path</code>. Returns true if activation succeeded or wasn’t needed because it was already activated. Returns false if it can’t find the path in a gem.</p>

                              <div class="method-source-code" id="try_activate-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 192</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">try_activate</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-comment"># finds the _latest_ version... regardless of loaded specs and their deps</span>
  <span class="ruby-comment"># if another gem had a requirement that would mean we shouldn&#39;t</span>
  <span class="ruby-comment"># activate the latest version, then either it would already be activated</span>
  <span class="ruby-comment"># or if it was ambiguous (and thus unresolved) the code in our custom</span>
  <span class="ruby-comment"># require will try to activate the more specific version.</span>

  <span class="ruby-identifier">spec</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">find_by_path</span> <span class="ruby-identifier">path</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">spec</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">activated?</span>

  <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">activate</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">LoadError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span> <span class="ruby-comment"># this could fail due to gem dep collisions, go lax</span>
    <span class="ruby-identifier">spec_by_name</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">find_by_name</span>(<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">spec_by_name</span>.<span class="ruby-identifier">nil?</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">spec_by_name</span>.<span class="ruby-identifier">activate</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-ui" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ui</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Lazily loads <a href="Gem/DefaultUserInteraction.html"><code>DefaultUserInteraction</code></a> and returns the default UI.</p>

                              <div class="method-source-code" id="ui-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 959</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">ui</span>
  <span class="ruby-identifier">require_relative</span> <span class="ruby-string">&quot;rubygems/user_interaction&quot;</span>

  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultUserInteraction</span>.<span class="ruby-identifier">ui</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-use_gemdeps" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">use_gemdeps</span><span
                                class="method-args">(path = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Looks for a gem dependency file at <code>path</code> and activates the gems in the file if found.  If the file is not found an ArgumentError is raised.</p>

<p>If <code>path</code> is not given the RUBYGEMS_GEMDEPS environment variable is used, but if no file is found no exception is raised.</p>

<p>If ‘-’ is given for <code>path</code> RubyGems searches up from the current working directory for gem dependency files (gem.deps.rb, Gemfile, Isolate) and activates the gems in the first one found.</p>

<p>You can run this automatically when rubygems starts.  To enable, set the <code>RUBYGEMS_GEMDEPS</code> environment variable to either the path of your gem dependencies file or “-” to auto-discover in parent directories.</p>

<p>NOTE: Enabling automatic discovery on multiuser systems can lead to execution of arbitrary code when used from directories outside your control.</p>

                              <div class="method-source-code" id="use_gemdeps-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1058</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">use_gemdeps</span>(<span class="ruby-identifier">path</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">raise_exception</span> = <span class="ruby-identifier">path</span>

  <span class="ruby-identifier">path</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;RUBYGEMS_GEMDEPS&quot;</span>]
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">path</span>

  <span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">dup</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;-&quot;</span>
    <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">traverse_parents</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">directory</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">dep_file</span> = <span class="ruby-constant">GEM_DEP_FILES</span>.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">f</span>) }

      <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">dep_file</span>

      <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">directory</span>, <span class="ruby-identifier">dep_file</span>
      <span class="ruby-keyword">break</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">path</span>.<span class="ruby-identifier">tap</span>(<span class="ruby-operator">&amp;</span><span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">UNTAINT</span>)

  <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span> <span class="ruby-identifier">path</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">raise_exception</span>

    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Unable to find gem dependencies file at #{path}&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;BUNDLE_GEMFILE&quot;</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-identifier">require_relative</span> <span class="ruby-string">&quot;rubygems/user_interaction&quot;</span>
  <span class="ruby-identifier">require</span> <span class="ruby-string">&quot;bundler&quot;</span>
  <span class="ruby-keyword">begin</span>
    <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultUserInteraction</span>.<span class="ruby-identifier">use_ui</span>(<span class="ruby-identifier">ui</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">silence</span> <span class="ruby-keyword">do</span>
        <span class="ruby-ivar">@gemdeps</span> = <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">setup</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">ensure</span>
      <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">DefaultUserInteraction</span>.<span class="ruby-identifier">ui</span>.<span class="ruby-identifier">close</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Bundler</span><span class="ruby-operator">::</span><span class="ruby-constant">BundlerError</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
    <span class="ruby-identifier">warn</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
    <span class="ruby-identifier">warn</span> <span class="ruby-string">&quot;You may need to `bundle install` to install missing gems&quot;</span>
    <span class="ruby-identifier">warn</span> <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-use_paths" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">use_paths</span><span
                                class="method-args">(home, *paths)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Use the <code>home</code> and <code>paths</code> values for <a href="Gem.html#method-c-dir"><code>Gem.dir</code></a> and <a href="Gem.html#method-c-path"><code>Gem.path</code></a>.  Used mainly by the unit tests to provide environment isolation.</p>

                              <div class="method-source-code" id="use_paths-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 969</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">use_paths</span>(<span class="ruby-identifier">home</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">paths</span>)
  <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">flatten!</span>
  <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">compact!</span>
  <span class="ruby-identifier">hash</span> = { <span class="ruby-string">&quot;GEM_HOME&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">home</span>, <span class="ruby-string">&quot;GEM_PATH&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">home</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_SEPARATOR</span>) }
  <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">_</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span> }
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">paths</span> = <span class="ruby-identifier">hash</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-user_dir" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">user_dir</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Path for gems in the user’s home directory</p>

                              <div class="method-source-code" id="user_dir-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 103</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">user_dir</span>
  <span class="ruby-identifier">gem_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_home</span>, <span class="ruby-string">&quot;.gem&quot;</span>)
  <span class="ruby-identifier">gem_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">data_home</span>, <span class="ruby-string">&quot;gem&quot;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">gem_dir</span>)
  <span class="ruby-identifier">parts</span> = [<span class="ruby-identifier">gem_dir</span>, <span class="ruby-identifier">ruby_engine</span>]
  <span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;ruby_version&quot;</span>] <span class="ruby-keyword">unless</span> <span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;ruby_version&quot;</span>].<span class="ruby-identifier">empty?</span>
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">parts</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-user_home" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">user_home</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The home directory for the user.</p>

                              <div class="method-source-code" id="user_home-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 96</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">user_home</span>
  <span class="ruby-ivar">@user_home</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">find_home</span>.<span class="ruby-identifier">tap</span>(<span class="ruby-operator">&amp;</span><span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">UNTAINT</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-win_platform-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">win_platform?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Is this a windows platform?</p>

                              <div class="method-source-code" id="win_platform-3F-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 980</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">win_platform?</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">@@win_platform</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-identifier">ruby_platform</span> = <span class="ruby-constant">RbConfig</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>[<span class="ruby-string">&quot;host_os&quot;</span>]
    <span class="ruby-identifier">@@win_platform</span> = <span class="ruby-operator">!</span><span class="ruby-constant">WIN_PATTERNS</span>.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ruby_platform</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">r</span> }.<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">@@win_platform</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-write_binary" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">write_binary</span><span
                                class="method-args">(path, data)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Safely write a file in binary mode on all platforms.</p>

                              <div class="method-source-code" id="write_binary-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 758</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">write_binary</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">data</span>)
  <span class="ruby-identifier">open_file</span>(<span class="ruby-identifier">path</span>, <span class="ruby-string">&quot;wb&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">io</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">data</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOSPC</span>
  <span class="ruby-comment"># If we ran out of space but the file exists, it&#39;s *guaranteed* to be corrupted.</span>
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">path</span>) <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>)
  <span class="ruby-identifier">raise</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Class Methods</h3>
                </header>

                  <div id="method-c-already_loaded-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">already_loaded?</span><span
                                class="method-args">(file)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="already_loaded-3F-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1268</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">already_loaded?</span>(<span class="ruby-identifier">file</span>)
  <span class="ruby-identifier">$LOADED_FEATURES</span>.<span class="ruby-identifier">any?</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">feature_path</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">feature_path</span>.<span class="ruby-identifier">end_with?</span>(<span class="ruby-identifier">file</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">default_gem_load_paths</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">load_path_entry</span><span class="ruby-operator">|</span> <span class="ruby-identifier">feature_path</span> <span class="ruby-operator">==</span> <span class="ruby-node">&quot;#{load_path_entry}/#{file}&quot;</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_gem_load_paths" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_gem_load_paths</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="default_gem_load_paths-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 1274</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">default_gem_load_paths</span>
  <span class="ruby-ivar">@default_gem_load_paths</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">$LOAD_PATH</span>[<span class="ruby-identifier">load_path_insert_index</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lp</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">expanded</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">lp</span>)
    <span class="ruby-keyword">next</span> <span class="ruby-identifier">expanded</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">expanded</span>)

    <span class="ruby-constant">File</span>.<span class="ruby-identifier">realpath</span>(<span class="ruby-identifier">expanded</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-find_home" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">find_home</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Finds the user’s home directory.</p>

                              <div class="method-source-code" id="find_home-source">
            <pre><span class="ruby-comment"># File rubygems/defaults.rb, line 81</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">find_home</span>
  <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">home</span>.<span class="ruby-identifier">dup</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span>
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">win_platform?</span>
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;HOMEDRIVE&quot;</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;SystemDrive&quot;</span>], <span class="ruby-string">&quot;/&quot;</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-string">&quot;/&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-find_spec_for_exe" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">find_spec_for_exe</span><span
                                class="method-args">(name, exec_name, requirements)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="find_spec_for_exe-source">
            <pre><span class="ruby-comment"># File rubygems.rb, line 247</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">find_spec_for_exe</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">exec_name</span>, <span class="ruby-identifier">requirements</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;you must supply exec_name&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">exec_name</span>

  <span class="ruby-identifier">dep</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Dependency</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">name</span>, <span class="ruby-identifier">requirements</span>

  <span class="ruby-identifier">loaded</span> = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">loaded_specs</span>[<span class="ruby-identifier">name</span>]

  <span class="ruby-keyword">return</span> <span class="ruby-identifier">loaded</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">loaded</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">matches_spec?</span>(<span class="ruby-identifier">loaded</span>)

  <span class="ruby-identifier">specs</span> = <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">matching_specs</span>(<span class="ruby-keyword">true</span>)

  <span class="ruby-identifier">specs</span> = <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">find_all</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">executables</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">exec_name</span>
  <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exec_name</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">spec</span> = <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">first</span>
    <span class="ruby-identifier">msg</span> = <span class="ruby-node">&quot;can&#39;t find gem #{dep} with executable #{exec_name}&quot;</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">GemNotFoundException</span>, <span class="ruby-identifier">msg</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">spec</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

